﻿using System.Linq;
using PocketBook.Model;

namespace PocketBook.Views
{
    partial class BookPrintPreview
    {
        private Book _book;

        public BookPrintPreview()
        {
            InitializeComponent();
        }

        public Book Source
        {
            get { return _book; }
            set 
            { 
                _book = value;

                Pages.ItemsSource = _book.FoldablePrintingSequence.Zip(
                    Enumerable.Range(0, Book.TotalPages).Select(n => n % 2 == 0 ? -90 : 90),
                    (page, rotation) => new { Page = page, Rotation = rotation });
            }
        }
    }
}
